The performance of value classes is highly dependent on how they arerepresented in the virtual machine. Value class instances are immutable, haveno identity, and can only refer to other value objects or primitive values andsince they should be very lightweight and fast, it is important to optimizethem carefully. In this paper we present a technique to detect and compresscommon patterns of value class usage to improve memory usage and performance.The technique identifies patterns of frequent value object references andintroduces abbreviated forms for them. This allows to store multipleinter-referenced value objects in an inlined memory representation, reducingthe overhead stemming from meta-data and object references. Applied to a smallprototype and an implementation of the Racket language, we found improvementsin memory usage and execution time for several micro-benchmarks.
展开▼